package com.xcdh.orm.controller;

import com.xcdh.domain.RequestPage;
import com.xcdh.domain.vo.R;
import com.xcdh.orm.ddl.DDLTable;
import com.xcdh.orm.service.TableDocService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * TableDocController
 * Created by wjg on 2023/12/5.
 */
@RestController
@RequestMapping("/doc")
public class TableDocController  {

    @Autowired
    private TableDocService tableDocService ;

    @PostMapping("/tableDoc/{serviceId}/{dataBase}")
    public R tableDoc(@PathVariable String serviceId , @PathVariable String dataBase) {
        return R.okData(tableDocService.tableDoc(serviceId , dataBase)) ;
    }


    @PostMapping("/pageTableDoc/{serviceId}")
    public R pageTableDoc(@PathVariable String serviceId ,@RequestBody RequestPage<DDLTable> query) {
        return R.okData(tableDocService.pageTableDoc(serviceId , query)) ;
    }


    @PostMapping("/tableAllDocV2/{serviceId}/{tableName}/{dataBase}")
    public R tableAllDocV2(@PathVariable String serviceId ,@PathVariable String tableName, @PathVariable String dataBase) {
        return R.okData(tableDocService.tableAllDoc(serviceId ,tableName, dataBase)) ;
    }

    @PostMapping("/tableAllDoc/{serviceId}/{dataBase}")
    public  R tableAllDoc(@PathVariable String serviceId,@PathVariable String dataBase){
        return R.okData(tableDocService.tableAllDoc(serviceId , dataBase)) ;
    }
}
